<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="__CSS__/bootstrap.min.css" >
    <!--<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css">-->
    <style>
        .title_box{
            width: 100%;
            height: 35px;
            font-size: 24px;
            color: #3c8dbc;
            text-indent: 10px;
            line-height: 35px;
            font-weight: bold;
            border-bottom: 1px solid #ccc;
            margin: 20px auto;
            text-align: center;
        }
    </style>
</head>
<body>
    <div class="title_box">新增邀约分组目标</div>

    <div style="margin-right: 20px;">
        <form class="form-horizontal" id="commentForm" action="{:url('add_Yaoyue')}" method="post">
            <div class="form-group">
                <label class="col-sm-3 control-label" style="color: red;font-size: 15px;">任务类型：{$rwname}</label>
            </div>
            <div class="form-group">
                <label for="inputEmail3" class="col-sm-2 control-label">月份</label>
                <div class="col-sm-10">
                    <input type="text"  class="form-control"  value="{$data.date}" disabled>
                </div>
            </div>

            <input type="hidden" name="rwlx_id" value="{$data.rwlx_id}" >
            <input type="hidden" name="date"    value="{$data.date}" >

            {volist name='ygroup' id="vo" }
            <div class="form-group">
                <label for="inputPassword3" class="col-sm-2 control-label">{$vo.group_name}</label>
                <div class="col-sm-10">
                    <input type="hidden" name="{$vo.id}ids[]" value="{$vo.id}" >
                    <input type="text" class="form-control"  placeholder="请输入小组目标" name="{$vo.id}ids[]" >
                </div>
            </div>
            {/volist}

            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-primary" id="submit">新增</button>
                    <button type="reset" class="btn btn-default">重置</button>
                </div>
            </div>
        </form>
    </div>

    <script type="text/javascript" src="__JS__/jquery-2.2.3.min.js"></script>
    <script type="text/javascript" src="__JS__/moment.js"></script>
    <script type="text/javascript" src="__STATIC__/validate/jquery.validate.min.js"></script>
    <script type="text/javascript" src="__STATIC__/layer/layer.js"></script>
    <!--<script src="//cdn.bootcss.com/moment.js/2.18.1/locale/zh-cn.js"></script>-->
    <!--<script type="text/javascript" src="//cdn.bootcss.com/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>-->

    <script type="text/javascript">
//        $(function () {
//            $('#datetimepicker4').datetimepicker({
//                format: 'YYYY-MM',
//                defaultDate : new Date()
//            });
//        });

        $().ready(function() {
            // 在键盘按下并释放及提交后验证提交表单
            $("#commentForm").validate({
                submitHandler: function(form)
                {
                    $.ajax({
                        type: "POST",
                        url:  "{:url('add_Yaoyue')}",
                        data: $(form).serialize(),
                        beforeSend:function(){
                            $('#submit').attr("disabled","false"); //禁止点击
                        },
                        success: function(msg){
//                        console.log(msg);

                            if(msg.code==1){
                                $('#submit').attr("disabled","false"); //禁止点击
                                layer.msg(msg.msg, {icon: 1});
                                setTimeout(function(){
                                    parent.layer.closeAll();
                                },3000); //延迟演示
                            }else{
                                layer.msg(msg.msg, {icon: 2});
                                $('#submit').removeAttr("disabled"); //禁止点击
                            }

                        }
                    });
                }

            });
            return false;
        });



    </script>
</body>
</html>